﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace _9_IsPalindrome
{
    class Program
    {
        static void Main(string[] args)
        {
            int i = 1000021;

            bool result = IsPalindrome(i);

            Console.WriteLine(result);
            Console.ReadLine();
        }

        private static bool IsPalindrome(int x)
        {
            bool result = false;

            string str = x.ToString();

            while (str.Length > 0)
            {
                if (str[0] == str[str.Length - 1])
                {
                    str = str.Remove(str.Length - 1);
                    if (str.Length > 0)
                    {
                        str = str.Remove(0, 1);
                    }
                    result = true;
                }
                else
                {
                    result = false;
                    break;
                }
            }

            return result;
        }
    }
}
